package com.middlegroup.pay;

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;

public class DecodeUtil {

    private static final String ALGORITHM = "AES";

    private static final String ALGORITHM_MODE_PADDING = "AES/ECB/PKCS7Padding";

    private static final String key = "ShwqJ7216FLnxO6skRBD7HfLZcVzSMXR";

    private static SecretKeySpec secretKey = new SecretKeySpec(Md5Util.MD5Encode(key, "UTF-8").toLowerCase().getBytes(), ALGORITHM);

    public static String decryptData(String base64Data) throws Exception {
        Cipher cipher = Cipher.getInstance(ALGORITHM_MODE_PADDING);
        cipher.init(Cipher.DECRYPT_MODE, secretKey);
        return new String(cipher.doFinal(Base64Utils.decode(base64Data)));
    }

    public static void main(String[] args) throws Exception {


        String A = "sy+JtGI7hcJcCxvBiOAE7jSWDvVud5UAV8Bvnn64VXK7nnReiAiKtg5SIaaf0Gn1aVgtZ5r6263H3RZNy5VwVB3qLVVztm5HATavEXzQCzXrpt3Ts8hWMjoCmQxIam9e34HtT0K9PwlthLuJqlK53IKJ2Ega3EAVMT5m+tgHw6JhluBplIZqzFNjGRB3NQT7m9Fbdjs5GAL/byMisCmKDID7NO/iTzX5p6MngWXkeaZ2TBfAhgg/SmDG2rWKroUzEzWdR4sNV/7X4d2CzeVQc4ZUWtnnMRn0sDbLBmy5Rnno2nGi/nkeHMmrr9FC6So1xfOcjht4uK+KAlIWknqkDhtCj3tRB895n+KPweWJnjR7BR64qjD4U3yyXHvtQVtVwdoZHAr8HWhgKIns2I6tXnr9Syyf4B+3hfKIPaIBdapDuD79CXWffDkaVoCB5H+ApqEyHtLWozduRF7EQkdwpbv9N7fit/Fatw6eDfgkQM4i1vQkcKPCVm8Cy2eYufc6Uk/kB2M2kUm7WEOPYNijub6M08d48+mkJMw+vz7AlvRaBSjp334kTibfhHVLlZ3IVHdXis8V+M6mxkyfVhxj08VWqcys9xyeO9Hex1mz9brpr1U+c6zh1MbpLB3WjxCeSezmXpSTURTuylwdJU6Vj2o5Xq5uPNx1S2o+1sODAOZCCj0ZMq6oWONadvf/iTMKX0CKkgwC62bkHF9/KBSXsV8714AJPDVlVlY+2XulOgU/Lep7q7EHnhH9jZ3PwQ507gg5Y1dus+bdbuhUYyDae3JfvRa64tGMNfPljocsj4cgDA5WKVFhfqkTpvZBRxUGUIjBXSnWFxutdAWA+XCSQPexYRfGZDLYO2/9df8hVseIuzDhU6FBZBpotVMvWOWmu98I15LmNk5kkqBkOrDog7pYe8zCNMWf9cp3mKfMCqqd9Az8x5/bXq0ubANnRlA5X6u1a18gMMcLNSkZVg3l/PM4A72BXb0uKtLf3pTknMUgT5kg35aU3Y7wB3fha1x7hWNNRWgnW5ZEutv30hoeq0IRos4X+CF+PUECe6Hy424DH5qSiuaAbL7Efqwd8gnUeoRktV11tUKnObBENwfvdw==";
        String B = DecodeUtil.decryptData(A);
        System.out.println(B);
    }


}
